<template>
  <a-spin :spinning="confirmLoading">
 
      <a-form-model ref="formData4" style="max-width: 800px; margin: 30px auto 0;">
        <a-alert
          :closable="true"
          message="请认真填写抄表信息，红框必填！"
          style="margin-bottom: 24px;"     />  
        <a-row>
          <a-col :span="12">
            <a-form-model-item label="抄表周期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="waterReadCycle">
              <j-dict-select-tag type="list" class="inpRequire" v-model="formData4.waterReadCycle" dictCode="water_read_cycle" placeholder="请选择抄表周期" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
             <a-form-model-item label="抄表本" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bookId">
              <j-search-select-tag v-model="formData4.bookId" class="inpRequire" dict="mws_t_mr_books,name,id"  />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="本月是否要抄表" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isRead">
              <j-dict-select-tag type="list" class="inpRequire" v-model="formData4.isRead" dictCode="yn" placeholder="请选择本月是否要抄表" />
            </a-form-model-item>
          </a-col>           
          <a-col :span="12">
            <a-form-model-item label="应抄次数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="readTimes">
              <a-input v-model="formData4.readTimes" class="inpRequire" placeholder="请输入应抄次数" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="待抄次数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="unreadTimes">
              <a-input v-model="formData4.unreadTimes" class="inpRequire" placeholder="请输入待抄次数" style="width: 100%" />
            </a-form-model-item>
          </a-col>
           <a-col :span="12">
            <a-form-model-item label="初始读数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="firstScale">
              <a-input v-model="formData4.firstScale" class="inpRequire" placeholder="请输入初始读数" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="应缴费日" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="paidDay">
              <a-input v-model="formData4.paidDay" class="inpRequire" placeholder="请输入应缴费日"  ></a-input>
            </a-form-model-item>
          </a-col> 
        </a-row>
        <a-form-item :wrapperCol="{span: 19, offset: 10}">
          <a-button style="margin-left: 8px" @click="prevStep">上一步</a-button>
          <a-button style="margin-left: 8px" type="primary" @click="nextStep">下一步</a-button>
        </a-form-item>
      </a-form-model>
  </a-spin>
</template>


<script>
  import { httpAction, getAction } from '@/api/manage'
  export default {
    name: "ArcCusStep4",
    props: ["formData4"],
    data () {
      return {
        confirmLoading: false,
        codeStatus: true,
        disabled: {
          type: Boolean,
          default: false,
          required: false
        },

        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        url: {          
          addCusNo: "/arc/arcCustomers/addCusNo",        
        }
      }
    },
    created () {
     
    },
    methods: {
      nextStep () {
        if(this.verifyForm()){
          this.$emit('nextStep')
        }; 
      }, 
      prevStep () {
        this.$emit('prevStep')
      },
      verifyForm(){
        let vrs=true;
        if(! this.formData4.waterReadCycle){
          this.$message.warning('请选择抄表周期');
          vrs=false;
        }
        if(! this.formData4.bookId){
          this.$message.warning('请选择抄表本');
          vrs=false;
        }
        if(! this.formData4.isRead){
          this.$message.warning('请选择本月是否抄表');
          vrs=false;
        }
        if(! this.formData4.readTimes){
          this.$message.warning('请填写应抄次数');
          vrs=false;
        }
        if(! this.formData4.unreadTimes){
          this.$message.warning('请填写待抄次数');
          vrs=false;
        }
        if(! this.formData4.firstScale){
          this.$message.warning('请填写初装读数');
          vrs=false;
        }
        if(! this.formData4.paidDay){
          this.$message.warning('请填写缴费日');
          vrs=false;
        }        
        return vrs; 
      }, 
      addInit(){
        const that = this
        httpAction(this.url.addCusNo,null,'get').then((res)=>{
          if(res.success){         
            
            that.codeStatus=true;
          }else{
            that.$message.warning(res.message);
          }
        }).finally(() => {
          that.confirmLoading = false;
        })
      }    
    }
  }
</script>

<style scoped>

  .inpRequire {
    border: 1px solid #974c4c;
  }

</style>